/**
 * @(#)ApplicationFactory.java 1.0 2013/9/18
 * Copyright 2013 PD, Inc. All rights reserved.
 */
package cn.broadin.app.hotel.factory;

import cn.broadin.app.hotel.application.CommonApplication;
import cn.broadin.app.hotel.application.IApplication;
import cn.broadin.app.hotel.application.STB_FLAG;
import cn.broadin.app.hotel.application.XiaoMiApplication;
import android.util.Log;


/**
*
* ApplicationFactory 全局变量factory
* @author fenghui
*
*/
public class ApplicationFactory {
	
	private static final String TAG = "ApplicationFactory";		//log tag
	private static IApplication application = null;				//全局变量对象
	
	/**
	 * 获取全局变量对象
	 * @return
	 */
	public static IApplication getApplication() {
		if(application == null) {
			switch (IApplication.STB_TAG_FLAG) {
			case STB_FLAG.COMMON:
				application = new CommonApplication();
				Log.i(TAG, "create CommonApplication.");
				break;
			case STB_FLAG.XIAOMI:
				application = new XiaoMiApplication();
				Log.i(TAG, "create XiaoMiApplication.");
				break;
			default:
				application = new CommonApplication();
				Log.i(TAG, "create default, CommonApplication.");
				break;
			}
		}
		return application;
	}
}